home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / dlibsrc.arc / STRREV.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-05  |  242 b   |  19 lines

  1. char *strrev(string)
  2.     char *string;
  3.     {
  4.     register char *p = string, *q, c;
  5.  
  6.     if(*(q = p))        /* non-empty string? */
  7.         {
  8.         while(*++q)
  9.             ;
  10.         while(--q > p)
  11.             {
  12.             c = *q;
  13.             *q = *p;
  14.             *p++ = c;
  15.             }
  16.         }
  17.     return(string);
  18.     }
  19.